package com.briup.day2;

import java.util.Scanner;

public class Test9 {

    // 判断是否是闰年
    public static boolean isLeapYear(int year) {
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int day = scanner.nextInt();
        int days = 0;
        int[] array = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};

        days = array[month-1] + day;
        if (isLeapYear(year) && month > 2) {
            days += 1;
        }
        System.out.println(days);
    }
}
